<?php
/* @var $this CategoryController */
/* @var $model Category */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'category-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'category'); ?>
		<?php echo $form->textField($model,'category'); ?>
		<?php echo $form->error($model,'category'); ?>
	</div>

	<?php /*<div class="row">
		<?php echo $form->labelEx($model,'slug'); ?>
		<?php echo $form->textArea($model,'slug',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'slug'); ?>
	</div>*/?>
	
	<div class="row">
		<?php echo $form->labelEx($model,'slug'); ?>
		<?php // echo $form->textField($model,'slug'); ?>
        <?php echo CHtml::activeTextField($model, 'slug', array('class' => 'content')); ?>
        <?php 
				
				Yii::app()->clientScript->registerScript('effect', '
				$("#Category_category").keyup(function(){
        var Text = $(this).val();
        Text = Text.toLowerCase();
        var regExp = /\s+/g;
        Text = Text.replace(regExp,"-");
        $("#Category_slug").val(Text);        
});
				', CClientScript::POS_READY);
				?> 
        
		<?php echo $form->error($model,'slug'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'parent_cat'); ?>
		<?php echo $form->dropDownList($model,'parent_cat',array('0','1')); ?>
		<?php echo $form->error($model,'parent_cat'); ?>
	</div>

	<?php /*<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div> */?>
	<div class="row">
	<?php echo $form->labelEx($model,'content'); ?>
	<?php $this->widget('application.extensions.eckeditor.ECKEditor', array(
                'model'=>$model,
                'attribute'=>'content',
                )); ?>
				<?php echo $form->error($model,'content'); ?>
				</div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->dropDownList($model,'status',array('Active', 'Inactive')); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->